<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            function f1(){
                var s="Fsadfsadf234534asdfsdaf456547dfssdaf3241lkjklj7657jjj"


                console.log(s.length);


                console.log(s.charAt(3));
                console.log(s.substring(3,6));
                console.log(s.indexOf("f"));
                console.log(s.lastIndexOf("f"));

                console.log(s.toUpperCase());

                console.log("   sdaf asdfsadf asdf   ".trim());

                console.log(s.replace(/f/,"X"));
                console.log(s.replace(/f/g,"X"));
                console.log(s.replace(/f/gi,"X"));
                console.log(s.replace(/\d/g,"X"));
                console.log(s.replace(/\d+/g,"X"));

                var s2="15948795245,18945789785,18111122345,13789878789";

                console.log(s2.replace(/(\d{3})(\d{5})(\d{3})/g,"$1*****$3"))

                console.log(s.match(/\d+/g));

                console.log(s.search(/\d+/g));

                //统计s中“a”出现了几次
                var s3=s.replace(/a/g,"");
                console.log(s.length-s3.length);


                var i=364;//[0,99999]
                //补0，不满5位的前面补0变成5位  34->00034

                var s4="0000"+i;
                console.log(s4.substring(s4.length-5))

            }

            function f2(){
                var reg=/^\d{3,4}-\d{8}$/;

                var str="025-12345678";

                console.log(reg.test(str));


            }
        </script>
    </head>
    <body>
        <a href="javascript:;" onclick="f1();">test1</a>
        <a href="javascript:;" onclick="f2();">test2</a>
    </body>
</html>